#!/usr/bin/perl

$hostname=$ARGV[0];
$hostname ne "" or $hostname="localhost";
$r = `ping  -c 1 $hostname`;

if($r=~/time=(.*) ms/m){
	print($1);
	exit(0);
}
exit(-1);
